import streamlit as st
import pandas as pd
# 按钮
if st.button('Say hello'):
    st.write('Why hello there')
else:
    st.write('Goodbye')
# 勾选项
agree = st.checkbox('I agree')
if agree:
    st.write('Great!')
# 单选项
genre = st.radio("What's your favorite movie genre", ('Comedy', 'Drama', 'Documentary'))
if genre == 'Comedy':
    st.write('You selected comedy.')
else:
    st.write("You didn't select comedy.")
# 下拉框
option = st.selectbox('How would you like to be contacted?', ('Email', 'Home phone', 'Mobile phone'))
st.write('You selected:', option)
# 多选框
options = st.multiselect('What are your favorite colors', ['Green', 'Yellow', 'Red', 'Blue'], ['Yellow', 'Red'])
st.write('You selected:', options)
# 滑块（单）
age = st.slider('How old are you?', 0, 130, 25)
st.write("I'm ", age, 'years old')
# 滑块（双）
values = st.slider('Select a range of values', 0.0, 100.0, (25.0, 75.0))
st.write('Values:', values)
# 输入框
title = st.text_input('Movie title', 'Life of Brian')
st.write('The current movie title is', title)
# 数字选择项
number = st.number_input('Insert a number')
st.write('The current number is ', number)
# 多行输入框
txt = st.text_area('Text to analyze', '''
    It was the best of times, it was the worst of times, it was
    the age of wisdom, it was the age of foolishness, it was
    the epoch of belief, it was the epoch of incredulity, it
    was the season of Light, it was the season of Darkness, it
    was the spring of hope, it was the winter of despair, (...)
    ''')
# 上传文件
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
if uploaded_file is not None:
    data = pd.read_csv(uploaded_file)
    st.write(data)
# 颜色选择
color = st.color_picker('Pick A Color', '#00f900')
st.write('The current color is', color)